﻿@model Guardian.Domain.Account.AccountDto

@{
    ViewData["Title"] = "Account Information";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h1>Account Information</h1>
<hr />
<div class="row">
    <div class="col-md-8">
        <form asp-action="Information">
            <div asp-validation-summary="ModelOnly" class="text-danger"></div>
            <div class="form-group">
                <label asp-for="FullName" class="control-label"></label>
                <input asp-for="FullName" class="form-control" />
                <span asp-validation-for="FullName" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="Email" class="control-label"></label>
                <input asp-for="Email" class="form-control" />
                <span asp-validation-for="Email" class="text-danger"></span>
            </div>
            <div class="form-row">
                <div class="form-group col-md-10">
                    <label asp-for="Token" class="control-label"></label>
                    <input asp-for="Token" class="form-control" />
                    <span asp-validation-for="Token" class="text-danger"></span>
                </div>
                <div class="form-group col-md-2">
                    <label class="control-label d-block">&nbsp;</label>
                    <input asp-for="ReGenerateToken" type="hidden" />
                    <input type="submit" id="reGenerateTokenBtn" value="Generate" class="btn btn-default" />
                </div>
            </div>
            <div class="form-group">
                <label asp-for="Password" class="control-label"></label>
                <input asp-for="Password" type="password" class="form-control" />
                <span asp-validation-for="Password" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="PasswordAgain" class="control-label"></label>
                <input asp-for="PasswordAgain" type="password" class="form-control" />
                <span asp-validation-for="PasswordAgain" class="text-danger"></span>
            </div>


            <div class="form-group">
                <input type="submit" value="Update" class="btn btn-primary" />
            </div>
        </form>
    </div>
</div>


@section Scripts{
    <script>
        $(document).ready(function () {
            $("#reGenerateTokenBtn").on("click", function () {
                $("#ReGenerateToken").val("true");
            });

            toggleHandlerForAutoCert();
            $("#AutoCert").change(toggleHandlerForAutoCert);

            function toggleHandlerForAutoCert() {
                if ($("#AutoCert").is(":checked")) {
                    $("#customCertificate").hide();
                    $("#autoCert").show();
                }
                else {
                    $("#customCertificate").show();
                    $("#autoCert").hide();
                }
            }
        });
    </script>
}